<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
	</body>
	<script>
		/* 毛坯房 - 目标对象 */
		class OriginHouse {
			getDesc() {
				console.log('毛坯房')
			}
		}

		/* 搬入家具 - 装饰者 */
		class Furniture {
			constructor(house) {
				this.house = house
			}

			getDesc() {
				this.house.getDesc()
				console.log('搬入家具')
			}
		}

		/* 墙壁刷漆 - 装饰者 */
		class Painting {
			constructor(house) {
				this.house = house
			}

			getDesc() {
				this.house.getDesc()
				console.log('墙壁刷漆')
			}
		}

		let house = new OriginHouse()
		house = new Furniture(house)
		house = new Painting(house)

		house.getDesc()
		// 输出： 毛坯房  搬入家具  墙壁刷漆
	</script>

</html>